/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f8f9fa;
    padding: 0;
    margin: 0;
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.amount, .total-amount strong {
    font-weight: bold;
    color: #e74c3c;
    font-size: 1.3rem;
}

/* 顶部提示框样式 */
.top-notification {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #323232;
    color: white;
    text-align: center;
    padding: 15px;
    z-index: 2000;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    font-size: 16px;
}

.top-notification.show {
    transform: translateY(0);
}

/* 负数金额样式 */
.total-amount strong.negative-amount {
    color: #f44336;
    font-weight: bold;
    animation: blink 1s infinite alternate;
}

@keyframes blink {
    from { opacity: 1; }
    to { opacity: 0.7; }
}

/* 登录屏幕样式 */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.login-form {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    width: 350px;
    text-align: center;
}

.announcement {
    background-color: #f8f9fa;
    border-left: 4px solid #4CAF50;
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
    text-align: left;
}

.announcement p {
    margin: 0;
    color: #333;
    font-size: 0.95rem;
    line-height: 1.5;
}

.password-input-group {
    margin: 15px 0;
    text-align: left;
}

.password-input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.password-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.login-btn {
    width: 100%;
    margin-top: 10px;
}

.login-error {
    color: #f44336;
    margin-top: 15px;
    font-size: 0.9rem;
}

/* 主内容样式 */
.main-content {
    padding: 20px;
}

.hidden {
    display: none;
}

.container {
    max-width: 1200px;
    margin: 2rem auto;
    background-color: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: transform 0.3s ease;
}

.container:hover {
    transform: translateY(-5px);
}

h1 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #eaeaea;
    font-size: 1.8rem;
    font-weight: 600;
}

.nav-links {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
    gap: 1.5rem;
}

.nav-links a {
    text-decoration: none;
    color: #3498db;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.nav-links a:hover {
    background-color: #e8f4fd;
    color: #2980b9;
}

/* 自定义模态框样式 */
.modal {
    display: none; /* 默认隐藏 */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 900px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    align-self: flex-end;
}

.copy-btn {
    margin-top: 15px;
    padding: 8px 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.copy-btn:hover {
    background-color: #45a049;
}

.close-btn:hover,
.close-btn:focus {
    color: black;
    text-decoration: none;
}

#json-content {
    margin-bottom: 15px;
    overflow: auto;
    max-height: calc(80vh - 100px);
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 6px;
    border: 1px solid #ddd;
    white-space: pre-wrap;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* 客户管理和销售统计红色按钮样式 */
.nav-btn-red {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    background-color: #fff;
    color: #e74c3c;
    border: 2px solid #e74c3c;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    width: 140px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

.nav-btn-red:hover {
    background-color: #ffebee;
    color: #c0392b;
    border-color: #c0392b;
}

.controls-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 1rem;
}

.customer-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.customer-selector label {
    font-weight: 500;
    color: #555;
    white-space: nowrap;
}

#customer-select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    min-width: 180px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#customer-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.btn {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    width: 140px;
    text-align: center;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* 导入下拉菜单样式 */
.import-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 6px;
    overflow: hidden;
}

.dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: background-color 0.3s ease;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
}

.import-dropdown:hover .dropdown-content {
    display: block;
}

.import-dropdown:hover .btn {
    background-color: #2980b9;
}

.btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn:active {
    transform: translateY(0);
    box-shadow: none;
}

#save-btn, #export-btn, #add-customer-btn, #delete-customer-btn {
    margin-left: 10px;
}

.delete-btn {
    background-color: #f44336;
}

.delete-btn:hover {
    background-color: #d32f2f;
}

.delete-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.product-section {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);

    @media (max-width: 768px) {
        padding: 1rem;
    }
}

/* 响应式模态框 */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

.product-section h2 {
    margin-bottom: 1.25rem;
    color: #2c3e50;
    font-size: 1.5rem;
    font-weight: 600;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

/* 平板及以上设备四列布局 */
@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 大屏幕五列布局 */
@media (min-width: 1200px) {
    .product-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.product-card {
    padding: 1.25rem;
    background-color: #f9f9f9;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.product-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #eee;
}



.product-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.price-input-group, .weight-input-group {
    display: flex;
    align-items: center;
}

.price-input-group label, .weight-input-group label {
    width: 120px;
    text-align: right;
    margin-right: 10px;
}

.amount-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.price-input-container {
    position: relative;
    display: inline-block;
}

.price-input, .weight-input {
    width: 100px;
    padding: 5px 30px 5px 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.input-unit {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.875rem;
    color: #666;
    pointer-events: none;
}

.amount {
    font-weight: bold;
    color: #e74c3c;
}

.total-section {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    padding: 10px 0;
}

.total-label {
    font-size: 18px;
    color: #333;
}

.total-amount {
    font-size: 18px;
    color: #e74c3c;
}

/* 导航链接样式 */
.nav-links {
    margin: 20px 0;
    text-align: right;
}

.nav-links a {
    margin-left: 15px;
    text-decoration: none;
    color: #4CAF50;
    font-weight: bold;
}

/* 客户管理页面样式 */
.customer-management {
    margin-top: 30px;
}

.add-customer-section {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.customer-table {
    width: 100%;
    border-collapse: collapse;
}

.customer-table th, .customer-table td {
    padding: 12px 15px;
    border: 1px solid #ddd;
    text-align: left;
}

.customer-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.customer-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.delete-btn {
    background-color: #f44336;
}

.delete-btn:hover {
    background-color: #d32f2f;
}

.statistics-filters {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.statistics-filters label {
    font-weight: bold;
}

.statistics-filters select {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.summary-cards {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.card {
    flex: 1;
    min-width: 200px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.card h3 {
    margin-top: 0;
    color: #333;
}

.card .amount {
    font-size: 24px;
    font-weight: bold;
    color: #28a745;
}

.chart-container {
    margin-bottom: 30px;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sales-table-container {
    overflow-x: auto;
}

.sales-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sales-table th, .sales-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.sales-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.sales-table tr:hover {
    background-color: #f5f5f5;
}

.sales-table .amount {
    font-weight: bold;
    color: #28a745;
}

.details-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.details-table th, .details-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

/* 表格样式 */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #555;
}

tr:hover {
    background-color: #f9f9f9;
}

/* 输入框样式 */
input[type="number"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

input[type="number"]:focus {
    border-color: #66afe9;
    outline: none;
    box-shadow: 0 0 5px rgba(102, 175, 233, 0.25);
}

/* 金额和总计样式 */
.amount {
    font-weight: 600;
  
}

.total-row {
    background-color: #f8f9fa;
}

.total-amount {
    color: #e74c3c;
    font-size: 1.1rem;
}

/* 模态框样式 */
.modal {
    display: none; /* 默认隐藏 */
    position: fixed; /* 固定定位 */
    z-index: 1000; /* 确保在顶层 */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* 允许滚动 */
    background-color: rgba(0,0,0,0.4); /* 黑色背景半透明 */
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto; /* 15% 从顶部和居中 */
    padding: 20px;
    border: 1px solid #888;
    width: 400px; /* 固定宽度 */
    border-radius: 8px;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close-btn:hover, .close-btn:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

#confirm-add-customer {
    background-color: #2196F3;
}

#confirm-add-customer:hover {
    background-color: #0b7dda;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    th, td {
        padding: 8px 10px;
    }

    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    table, thead, tbody, th, td, tr {
        display: block;
    }

    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
    }

    td {
        border: none;
        position: relative;
        padding-left: 50%;
    }

    td:before {
        position: absolute;
        left: 6px;
        content: attr(data-label);
        font-weight: bold;
    }

    td:nth-of-type(1):before { content: "商品名称"; }
    td:nth-of-type(2):before { content: "单价 (元/公斤)"; }
    td:nth-of-type(3):before { content: "重量 (公斤)"; }
    td:nth-of-type(4):before { content: "金额 (元)"; }
}